<template>
    <div class='left'>
        <div 
        class='name'
        >
            <i 
            
            class='btn el-icon-loading'
            ></i>
            嘉宝橱柜</div>
        <el-menu 
        :default-active="this.defaultActive"
         
        class="el-menu-vertical-demo nav" 
        @open="handleOpen" 
        @close="handleClose"
        :collapse="isCollapse"
        background-color="#545c64"
        text-color="#fff"
        active-text-color="#ffd04b"
        :router='true'
        :unique-opened='true'
        >
            
            <el-menu-item index="/indexDefault">
                <i class="el-icon-document"></i>
                <span slot="title">首页</span>
            </el-menu-item>
            <!-- <el-submenu index="1">
                    <template slot="title">
                    <i class="el-icon-location"></i>
                    <span>移动端/小程序</span>
                    </template>
                    <el-menu-item-group>
                    <template slot="title">配置</template>
                    <el-menu-item index="/wechat/Home">首页定制</el-menu-item>
                    <el-menu-item index="/wechat/ProductList">商品列表</el-menu-item>
                    </el-menu-item-group>
                    
            </el-submenu> -->

            <el-submenu   
            v-for='item of this.AllList'
            :index="item.type"
            :key='item.id'
            :disabled="item.scope <= scope ? false:true "
            >
                    <template slot="title">
                    <i :class="item.icon"></i>
                    <span>{{item.type}}</span>
                    </template>
                    <el-menu-item-group
                    v-for='item2 of item.class'
                    :key='item2.title'>
                    <template slot="title">{{item2.title}}</template>
                    <el-menu-item
                    v-for='item3 of item2.detail'
                    :key='item3.title' 
                    :index="item3.path"
                    :disabled="item3.scope <= scope ? false:true "
                    @click="changeActive(item3.path)">{{item3.title}}</el-menu-item>
                    
                    </el-menu-item-group>
                    
            </el-submenu>




            <!-- <el-submenu index="2">
                    <template slot="title">
                    <i class="el-icon-menu"></i>
                    <span>后台信息系统</span>
                    </template>
                    <el-menu-item-group>
                    <template slot="title">信息列表</template>
                    <el-menu-item index="/wechat/Home">录入信息</el-menu-item>
                    <el-menu-item index="/wechatHome">2</el-menu-item>
                    </el-menu-item-group>
                    
            </el-submenu>
            <el-submenu index="3">
                    <template slot="title">
                    <i class="el-icon-menu"></i>
                    <span>管理员配置</span>
                    </template>
                    <el-menu-item-group>
                    <template slot="title">信息列表</template>
                    <el-menu-item index="/wechatHome">录入信息</el-menu-item>
                    <el-menu-item index="/wechatHome">2</el-menu-item>
                    </el-menu-item-group>
                    
            </el-submenu> -->
            
        </el-menu>
        <!-- <el-radio-group 
        class='btn'
        v-model="isCollapse" 
        style="margin-bottom: 20px;">
            <el-radio-button :label="false"></el-radio-button>
            <el-radio-button :label="true"></el-radio-button>
            
        </el-radio-group> -->
        
        
    </div>
</template>

<script>

import { mapState,mapMutations } from 'vuex'
export default {
    name:'IndexLeft',
    data (){
        return {
            isCollapse: false,
        }
    },
    computed:{
        ...mapState(['defaultActive','AllList','scope'])
    },
    methods: {
        handleOpen(key, keyPath) {
            console.log(key, keyPath);
            console.log(keyPath)

        },
        handleClose(key, keyPath) {
            console.log(key, keyPath);
        },
        changeActive(path){
        //   this.$store.dispatch('changeActive',path)
          this.changeActive(path)
        },
        ...mapMutations(['changeActive'])
    }
 }   
</script>

<style lang="stylus" scoped>
.left >>> .el-menu-item-group__title
    color #b7bbc7
    font-size 16px
.left
    position relative
    overflow hidden
    float left
    width 10%
    height 100vh
    .el-menu-vertical-demo:not(.el-menu--collapse) 
        // width: 192px;
        min-height: 400px;
        overflow hidden
    .nav
        
        overflow hidden
        height 100%
        
    .btn
        position absolute
        left 25px
        top 20px
        color rgb(255, 208, 75)
        font-size 21px
    .name
        letter-spacing 2px
        height 61px
        width 100%
        background rgb(84, 92, 100)
        color rgb(255, 208, 75)
        text-align center
        line-height 61px
        font-size 16px
        cursor pointer
    
</style>
